package May;

import java.util.Scanner;

public class DAY0525 {
    //完全数计算
    public static void main(String[] args) {
        //接收数据
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = PerfectNumber(scanner.nextInt());
            System.out.println(n);
        }
    }

    //计算当前数中有几个完全数
    private static int PerfectNumber(int n) {
        int count = 0;//用来记录完全数的个数
        for (int i = 1; i <= n ; i++) {
            int s = 0;
            for (int j = 1; j < i ; j++) {
                if (i%j == 0){
                    s += j;
                }
            }
            if (s == i){
                count++;
            }
        }
        return count;
    }

}
